const app = getApp();
Component({
	data: {

		tabs_active: 0,
		list: [
			{
				icon: 'home-o',
				text: '首页',
				url: '../index/index',
				url_i:'../pages/index/index',
				icon:'https://api.yipaiju.com/resources/images/wawa/icon_home11.png',
				iconActive:'https://api.yipaiju.com/resources/images/wawa/icon_home1.png',
			},
			{
				icon: 'search',
				text: '找房',
				url: '../lists/lists',
				url_i:'../pages/lists/lists',
				icon:'https://api.yipaiju.com/resources/images/wawa/icon_home22.png',
				iconActive:'https://api.yipaiju.com/resources/images/wawa/icon_home2.png'
			},
			{
				icon: 'search',
				text: '我的',
				url: '../home/home',
				url_i:'../pages/home/home',
				icon:'https://api.yipaiju.com/resources/images/wawa/icon_home33.png',
				iconActive:'https://api.yipaiju.com/resources/images/wawa/icon_home3.png'
			}
		]
	},

	methods: {
		onChange(event) {
			this.setData({ tabs_active: event.detail });
			wx.switchTab({
				url: this.data.list[event.detail].url
			});
		},

		init() {
			const page = getCurrentPages().pop();
			this.setData({
				tabs_active: this.data.list.findIndex(item => item.url_i === `../${page.route}`)
			});
			// console.log(this.data.active)
		},
    handleAgree() {
      this.data.resolve({ buttonId: 'agree-btn', event: 'agree' })
      this.setData({
        needPrivacy: false
      })
    },
    handleDisagree() {
      this.data.resolve({ event: 'disagree' })
      this.setData({
        needPrivacy: false
      })
    }
	}
});
